# automatic compilation of C++ source files of the test
# this source file was modified, so it is a good time to check if it  ; \
# has new header files dependencies                                   ; \

$(dir_tst)/%.o : $(qt_test_hs) $(dir_tst)/%.$(source_extension)
	$(show) ""                                                            ; \
	echo  "---------------------------------------- "                     ; \
	echo  "Compiling $<"                                                  ; \
        $(compile_command) $(final_test_inc_dir) $(compile_flags) $(final_test_minus_d) $< -o $@ 

#        $(cxx) -MMD -MG -MT '$@ $*.d' -c $< -o $@                             ; \
#        cp $*.d $*.tmp                                                        ; \
#        sed -e 's;#.*;;' -e 's;^[^:]*: *;;' -e 's; *\\$$;;' \                 ; \
#            -e '/^$$/d' -e 's;$$; :;' < $*.tmp >> $*.d                        ; \
#        rm $*.tmp                                                             ;

#	$(compile_command) $(final_test_inc_dir) $(compile_flags) $(final_test_minus_d) $< -o $@ ; \
#        $(depend_command) \


# automatic regeneration of header code files from qt-designer '.ui' files
$(dir_tst)/%.$(header_extension): $(dir_tst)/%.ui
	$(show) ""                                                            ; \
	echo  "---------------------------------------- "                     ; \
	echo  "Generating $@ from  $<"                                        ; \
	uic $< -o $@                                                          ; 


# automatic regeneration of source test files from qt-designer '.ui' files
#$(dir_code)/test/%.$(source_extension): $(dir_code)/test/%.ui
#	$(show) ""                                                            ; \
#	echo  "---------------------------------------- "                     ; \
#	echo  "Generating $@ from  $<"                                       ; \
#	echo  "NOT IMPLEMENTED"                                              ; \
#	touch $@                                                             ;
#	uic -impl $(dir_code)/test/$*.$(header_extension) $< -o $@


# builds the test as a program
test_build_pgm: 
	$(show) ""                                                           ; \
	echo "Building a program for $(project)"                             ; \
	$(program_command) $(program_prefix)$(project)_test$(program_sufix)    \
		$(test_objs) $(final_test_static_libs)                         \
                $(final_prj_lib_dir) $(final_prj_shared_libs)                  \
		$(final_test_lib_dir) $(final_test_shared_libs)                \
		$(search_lib_dir)                                            ; \
	mv $(program_prefix)$(project)_test$(program_sufix) $(dir_bin)         \
                    2> /dev/null                                             ;  


#                           PUBLIC

#@public@|test_clean|Cleans the Test of the Project
#@public_detailed@|test_clean|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] test_clean
#@public_detailed@|test_clean|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|test_clean|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
test_clean : 
	$(show) ""                                                                       ; \
	echo "********************************************* "                            ; \
	echo "Cleaning test for $(project)"                                              ; \
	rm -f $(dir_tst)/*.o  2> /dev/null                                               ; \
	rm -f $(dir_tst)/*~ 2> /dev/null                                                 ; \
	rm -f $(dir_tst)/*.d 2> /dev/null                                                ; \
	rm -f $(dir_bin)/$(program_prefix)$(project)_test$(program_sufix) 2> /dev/null   ; 


# setup

#@public@|test_compile|Compiles the Test of the Project
#@public_detailed@|test_compile|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] test_compile
#@public_detailed@|test_compile|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|test_compile|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
test_compile : setup $(test_objs)



#@public@|test_build|Builds the Test of the Project
#@public_detailed@|test_build|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] test_build
#@public_detailed@|test_build|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|test_build|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
#@public_detailed@|test_build|If in 'tenacitas.build_system/bin/<project-name>/tool/gmake/project.mk' is defined that 'test_type' is '$(library)', this command will generate a program library called '$(shared_prefix)<project-name>.test.$(shared_sufix)' and will place it in '$(build_lib_dir)', defined in 'tenacitas.build_system/tool/gmake/cpu_os_comp/<cpu-os-compiler>.mk'
#@public_detailed@|test_build|If in 'tenacitas.build_system/bin/<project-name>/tool/gmake/project.mk' is defined that 'test_type' is '$(program)', this command will generate a program library called '$(program_prefix)<project-name>.test.$(program_sufix)' and will place it in '$(build_bin_dir)'. 
##@public_detailed@|test_build|$(build_lib_dir), $(build_bin_dir), $(program_prefix), $(program_prefix), $(shared_prefix) and $(shared_sufix) are defined in 'tenacitas.build_system/tool/gmake/cpu_os_comp/<cpu-os-compiler>.mk'

# setup 
test_build : code_build_chain test_compile
	$(show) ""                                                           ; \
	echo "********************************************* "                ; \
	echo "Builing test for  $(project)"                                  ; \
	$(make_cmd) -s test_build_pgm                                        ; 


-include $(dir_tst)/*.d

#-include $(SOURCES:.cpp=.d)

#-include $(SOURCES:/home/rodrigo/Desenvolvimento/tenacitas/cpp//code/tst/tenacitas.text_log_file/%.cpp=/home/rodrigo/Desenvolvimento/tenacitas/cpp//code/tst/tenacitas.text_log_file/%.d)


